package com.rb;

import com.rb.common.CrossOriginFilter;
import com.rb.common.sqltpl.impl.velocity.VelocitySqlTpl;
import org.nutz.boot.NbApp;
import org.nutz.dao.Sqls;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.By;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.Ok;

@Filters(@By(type=CrossOriginFilter.class))
@IocBean(create="init")
public class MainLauncher {
    
    @Inject
    protected PropertiesProxy conf;

    
    @At("/")
    @Ok("json")
    public NutMap index() {
        NutMap map = new NutMap();
        map.put("success",true);
        map.put("msg","welcome");
        return map;
    }
	
	public void init() {
        Mvcs.DISABLE_X_POWERED_BY=true;
        Sqls.setSqlBorning(VelocitySqlTpl.class); //通过velocity模板做sql生成
    }

    public static void main(String[] args) throws Exception {
        new NbApp(MainLauncher.class).run();
    }

}
